package com.yupi.springbootinit.controller;/*
@author name
@data 2025/3/27-16:35
*/

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yupi.springbootinit.common.BaseResponse;
import com.yupi.springbootinit.common.ResultUtils;
import com.yupi.springbootinit.model.dto.chat.ChatRoomDto;
import com.yupi.springbootinit.model.dto.chat.ChatRoomQueryRequest;
import com.yupi.springbootinit.service.ChatRoomService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/chatRoom")
public class ChatRoomController {

    @Resource
    private ChatRoomService chatRoomService;

    @PostMapping
    public BaseResponse<Page<ChatRoomDto>> getRoomList(@RequestBody ChatRoomQueryRequest chatRoomQueryRequest,
                                                    HttpServletRequest request ){
        Page<ChatRoomDto> chatRoomList = chatRoomService.getChatRoomPage(chatRoomQueryRequest,request);
        return ResultUtils.success(chatRoomList);
    }

}
